#include<stdio.h>
#include<unistd.h>
#include<memory.h>

#define NUM 100
int main()
{
  char bar[NUM+1];
  int i = 0;
  memset(bar,0,sizeof(bar));
  const char* str = "-|/\\";
  printf("进度条开始运行\n");
  while(i <= NUM)
  {
    printf("[%-100s][%3d%%][%c]\r",bar,i,str[i%4]);
    fflush(stdout);
    usleep(50000);
    bar[i] = '=';
    i++;
  }
  printf("\n");
  return 0;
}
